#!/bin/bash

# 以下操作是进入 php 的 docker 容器里执行的

docker exec -it php-web bash

echo "更新源和扩展依赖 安装扩展开始！"
apt-get update 
apt-get install -y libfreetype6-dev 
apt-get install -y libjpeg62-turbo-dev 
apt-get install -y libpng-dev 
apt-get install -y libmemcached-dev autoconf gcc make zlib1g zlib1g-dev vim
apt-get install -y libicu-dev


echo "php 安装扩展开始！"
docker-php-ext-install pdo_mysql  
docker-php-ext-install mysqli
docker-php-ext-install bcmath
docker-php-ext-install mbstring
docker-php-ext-install gettext 
docker-php-ext-install pcntl
docker-php-ext-install shmop
docker-php-ext-install soap
docker-php-ext-install sysvsem
docker-php-ext-install sockets
docker-php-ext-install zip
docker-php-ext-install intl


docker-php-ext-install -j$(nproc) iconv
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
docker-php-ext-install -j$(nproc) gd

pear clear-cache
pear update-channels
pear upgrade

pecl install redis-5.1.0 && docker-php-ext-enable redis 
pecl install xdebug-2.6.0 && docker-php-ext-enable xdebug  
pecl install memcached-3.1.4 && docker-php-ext-enable memcached 
pecl install swoole-4.4.13 && docker-php-ext-enable swoole

echo "php扩展 安装结束！"
echo ""
exit



